import { ref } from 'vue'
import { defineStore } from 'pinia'

// 使用setup模式定义
export const userStore = defineStore('userSetup', () => {
  const name = ref<string>('')
  const UserType = ref<number>(9)
  const isLogin = ref<boolean>(false)
  const project_id = ref<string>('')
  const ori_project_id = ref<string>('')
  const origin_domain_name = ref<string>('')
  const changeId = ref<boolean>(false)
  const region = ref<string>('')

  function updateRegion(str: string) {
    region.value = str
  }
  function updateName(str: string) {
    name.value = str
  }
  function updateUserType(num: number) {
    UserType.value = num
  }

  function updateLogin(is: boolean) {
    isLogin.value = is
  }
  function updateProject_id(str: string) {
    project_id.value = str
  }
  function oriProject_id(str: string) {
    ori_project_id.value = str
  }
  function updateChangeId(is: boolean) {
    changeId.value = is
  }
  function updateOrigin(obj: any) {
    origin_domain_name.value = obj
  }
  return {
    region,
    updateRegion,
    name,
    updateName,
    isLogin,
    updateLogin,
    UserType,
    updateUserType,
    project_id,
    updateProject_id,
    changeId,
    updateChangeId,
    origin_domain_name,
    updateOrigin,
    ori_project_id,
    oriProject_id

  }
})
